﻿@using SkyLinq.Web.Models
@model LINQPadViewModel

@{
    ViewBag.Title = "Sky LINQPad";
}

<h2>Sky LINQPad</h2>


@using (Html.BeginForm("Index", "SkyLINQPad", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()

    <div class="form-horizontal">
        <hr />
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })
        <div class="form-group">
            @Html.Label("Upload a .linq file", htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                <input type="file" class="form-control" name="fileUpload" />
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Kind, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.DropDownListFor(model => model.Kind, new SelectList(Enum.GetValues(typeof(KindEnum))),
                    new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Kind, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.References, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.References, new { htmlAttributes = new { @class = "form-control", rows = "2" } })
                @Html.ValidationMessageFor(model => model.References, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Namespaces, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Namespaces, new { htmlAttributes = new { @class = "form-control", rows = "3" } })
                @Html.ValidationMessageFor(model => model.Namespaces, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Code, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Code, new { htmlAttributes = new { @class = "form-control", rows = "5" } })
                @Html.ValidationMessageFor(model => model.Code, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Run" class="btn btn-default" />
            </div>
        </div>
    </div>
}
<hr />
<div>
    @Html.DisplayFor(model => model.Results)
</div>
@section Scripts {
    <script src="@Url.Content("/Scripts/codemirror.js")"></script>
    <script src="@Url.Content("/Scripts/mode/clike/clike.js")"></script>
    <script>
        var editor = CodeMirror.fromTextArea(document.getElementById("Code"), {
            lineNumbers: true,
            mode: "text/x-csharp"
        });
    </script>
}
@section Styles {
    <link rel="stylesheet" href="@Url.Content("/Content/codemirror.css")">
}